package androidx.preference;

import android.content.Context;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;

final class b extends Preference {
    private long Q;

    b(Context context, List<Preference> list, long j) {
        super(context);
        F0();
        G0(list);
        this.Q = j + 1000000;
    }

    private void F0() {
        q0(q.expand_button);
        n0(o.ic_arrow_down_24dp);
        x0(r.expand_button_title);
        t0(999);
    }

    private void G0(List<Preference> list) {
        ArrayList arrayList = new ArrayList();
        CharSequence charSequence = null;
        for (Preference next : list) {
            CharSequence B = next.B();
            boolean z = next instanceof PreferenceGroup;
            if (z && !TextUtils.isEmpty(B)) {
                arrayList.add((PreferenceGroup) next);
            }
            if (arrayList.contains(next.r())) {
                if (z) {
                    arrayList.add((PreferenceGroup) next);
                }
            } else if (!TextUtils.isEmpty(B)) {
                if (charSequence == null) {
                    charSequence = B;
                } else {
                    charSequence = i().getString(r.summary_collapsed_preference_list, new Object[]{charSequence, B});
                }
            }
        }
        v0(charSequence);
    }

    public void P(l lVar) {
        super.P(lVar);
        lVar.P(false);
    }

    /* access modifiers changed from: package-private */
    public long m() {
        return this.Q;
    }
}
